package com.java.lambda.exercise;

import java.util.function.IntConsumer;

public class LambdaDemoLX1_03 {
    
    public static void main(String[] args) {
        
        foreachArr(new IntConsumer() {
            @Override
            public void accept(int value) {
                System.out.println(value);
            }
        });
        
        foreachArr(value1 -> System.out.println(value1));
    }
    
    public static void foreachArr(IntConsumer consumer){
        int[] arr = {1,2,3,4,5,6,7,8,9,10};
        for(int i : arr){
            consumer.accept(i);
        }
    }
}
